import 'package:flutter/material.dart';

class FloatingAppBarAboveListDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final title = 'Horizontal List';

    return Scaffold(
      // appBar: AppBar(
      //   title: Text(title),
      // ),
      body: CustomScrollView(
        slivers: <Widget>[
          SliverAppBar(
            title: Text('Floating app bar'),
            // Allows the user to reveal the app bar if they begin scrolling back
            // up the list of items
            floating: true,
            // Display a placeholder Widget to visualize the shrinking size
            flexibleSpace: Placeholder(),
            // Make the initial height of the SliverAppBar larger than normal
            expandedHeight: 300,
          ),
          SliverList(
            delegate: SliverChildBuilderDelegate(
              (context, index) => ListTile(title: Text('Item #$index'),),
              childCount: 1000,
            ),
          ),
        ],
      ),
    );
  }
}
